package com.lzxuni.modules.plantingprogram.service.impl;

import com.lzxuni.modules.common.entity.PageParameter;
import com.lzxuni.modules.plantingprogram.entity.PlantingProgramDetail;
import com.lzxuni.modules.plantingprogram.mapper.PlantingProgramDetailMapper;
import com.lzxuni.modules.plantingprogram.service.PlantingProgramDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
import com.lzxuni.common.utils.StringUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

/**
 * <p>
 * 种植方案_明细 服务实现类
 * </p>
 *
 * @author LaoNa
 * @since 2020-12-18
 */
@Service
public class PlantingProgramDetailServiceImpl extends ServiceImpl<PlantingProgramDetailMapper, PlantingProgramDetail> implements PlantingProgramDetailService {

        @Override
        public PageInfo<PlantingProgramDetail> queryPage(PageParameter pageParameter, PlantingProgramDetail plantingProgramDetail) {
            if (StringUtils.isNotEmpty(pageParameter.getSidx())) {
                PageHelper.startPage(pageParameter.getPage(), pageParameter.getRows()).setOrderBy(
                pageParameter.getSidx() + " " + pageParameter.getSord());
            } else {
                PageHelper.startPage(pageParameter.getPage(), pageParameter.getRows());
            }
            List<PlantingProgramDetail> plantingProgramDetailList = baseMapper.queryList(plantingProgramDetail);
            PageInfo<PlantingProgramDetail> pageInfo = new PageInfo<>(plantingProgramDetailList);
            return pageInfo;
        }

        @Override
        public List<PlantingProgramDetail> queryList(PlantingProgramDetail plantingProgramDetail) {
            List<PlantingProgramDetail> plantingProgramDetailList = baseMapper.queryList(plantingProgramDetail);
            return plantingProgramDetailList;
        }

}
